package com.cloud.wms.ui.main.entity;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * @Author:Chen
 * @Date: 2021-01-23 23:33
 * @Description:
 */
public class BatchEntity implements Parcelable {
    protected long productBatchID;
    protected String productionDate;
    protected String expirationDate;
    protected String inDate;
    protected int amount;
    protected boolean isSelect;

    public boolean isSelect() {
        return isSelect;
    }

    public void setSelect(boolean select) {
        isSelect = select;
    }

    public int getAmount() {
        return amount;
    }

    public void setAmount(int amount) {
        this.amount = amount;
    }

    public long getProductBatchID() {
        return productBatchID;
    }

    public void setProductBatchID(long productBatchID) {
        this.productBatchID = productBatchID;
    }

    public String getProductionDate() {
        return productionDate == null ? "" : productionDate.replace("T", " ");
    }

    public void setProductionDate(String productionDate) {
        this.productionDate = productionDate;
    }

    public String getExpirationDate() {
        return expirationDate == null ? "" : expirationDate.replace("T", " ");
    }

    public void setExpirationDate(String expirationDate) {
        this.expirationDate = expirationDate;
    }

    public String getInDate() {
        return inDate == null ? "" : inDate.replace("T", " ");
    }

    public void setInDate(String inDate) {
        this.inDate = inDate;
    }

    public BatchEntity() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeLong(this.productBatchID);
        dest.writeString(this.productionDate);
        dest.writeString(this.expirationDate);
        dest.writeString(this.inDate);
        dest.writeInt(this.amount);
        dest.writeByte(this.isSelect ? (byte) 1 : (byte) 0);
    }

    protected BatchEntity(Parcel in) {
        this.productBatchID = in.readLong();
        this.productionDate = in.readString();
        this.expirationDate = in.readString();
        this.inDate = in.readString();
        this.amount = in.readInt();
        this.isSelect = in.readByte() != 0;
    }

    public static final Creator<BatchEntity> CREATOR = new Creator<BatchEntity>() {
        @Override
        public BatchEntity createFromParcel(Parcel source) {
            return new BatchEntity(source);
        }

        @Override
        public BatchEntity[] newArray(int size) {
            return new BatchEntity[size];
        }
    };
}
